# _*_ coding:utf-8 _*_
#索引和一维运算
import pandas as pd
#pip install -v pandas==0.20.3
import numpy as np

data = np.random.randn(6)  # 一维随机数6个
print data  # 查看data
index = ['a', 'b', 'c', 'd', 'e', 'f']

s = pd.Series(data, index)  #index=index也可以
print s  # 第7行的data数值不变
print 2 * s

#二维  Series 字典 -> DataFrame 
d = {'one': pd.Series([1., 2., 3.], index=['a', 'b', 'c']),
     'two': pd.Series([1., 2., 3., 4.], index=['a', 'b', 'c', 'd'])}

df = pd.DataFrame(d)  # 新建 DataFrame
print df

'''
   one  two
a  1.0  1.0
b  2.0  2.0
c  3.0  3.0
d  NaN  4.0

'''